#include <iostream>
#include <vector>
using namespace std;

int binarySearch(vector<int> &a, int val, int l, int r)
{
    while (l <= r)
    {
        int mid = (l + r) >> 1;
        if (a[mid] > val)
        {
            r = mid - 1;
        }
        else if (a[mid] < val)
        {
            l = mid + 1;
        }
        else
        {
            while(mid>0&&a[mid-1]==val){
                mid--;
            }
            return mid+1;
        }
    }
    return -1;
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<int> b(m);
    for (int i = 0; i < m; i++)
    {
        cin >> b[i];
    }
    for (int i = 0; i < m; i++)
    {
        int index = binarySearch(a, b[i], 0, n - 1);
        cout << index;
        if (i != n - 1)
        {
            cout << " ";
        }
    }
    system("pause");
    return 0;
}